package client.behavioral.visitor;

import org.junit.Test;
import org.xml.sax.SAXException;
import uml.behavioral.visitor.*;
import util.bean.BeanUtil;

import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;

/**
 * 访问者--客户端<br>
 * on 2023/1/3 20:52
 */
public class Client {
    @Test
    public void t() throws ParserConfigurationException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, SAXException {
        ObjectStructure os = new ObjectStructure();
        //如需更换访问者，需要调整配置文件中visitorName的顺序
        AwardCheck checker = BeanUtil.newBean(AwardCheck.class,
                new File("src/main/resources/xml/visitor.xml"),
                "visitorName");
        Teacher t1 = new Teacher(8, 95, "刘备");
        Teacher t2 = new Teacher(23, 99, "诸葛亮");
        Student s1 = new Student(19, 98, "马谡");
        Student s2 = new Student(25, 97, "姜维");
        os.add(t1);
        os.add(t2);
        os.add(s1);
        os.add(s2);

        os.checkBy(checker);
    }
}
